package com;


import com.fz.dao.UserDao;
import com.fz.entity.Student;
import com.fz.entity.Teacher;
import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;


/**
 * Created by bai on 2017/7/3.
 */

public class Demo {
    @Test
    public void init(){
        ClassPathXmlApplicationContext cxt = new ClassPathXmlApplicationContext("beans.xml");
        Student stu = cxt.getBean("student",Student.class);

        stu.getTeacher().show();
        //stu.getTeacher().a();
        cxt.close();
    }

    @Test
    public void a(){
        ClassPathXmlApplicationContext cxt = new ClassPathXmlApplicationContext("beans.xml");
        UserDao u = cxt.getBean("userDao",UserDao.class);
        System.out.println("-----------------");
        u.so();
        System.out.println("--------------");
        Teacher t = cxt.getBean("teacher",Teacher.class);
        t.a();
        System.out.println("*******************");
    }

}
